﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Persistance.Model;
using Lib;


/// <summary>
/// Summary description for SiteHelper
/// </summary>
public class SiteHelper
{
    public SiteHelper()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    public static Users getCurrentUser()
    {
        MembershipUser netUser = Membership.GetUser();
        Users user = new Users();

        user.UserGUID = (Guid)netUser.ProviderUserKey;
        return user.getMyInfo();
    }

     public static Control getControl(ControlCollection list, string name)
 {
     Int16 counter;
    
     for (counter = 0; counter <= list.Count - 1; counter++) {
         if ((list[counter].FindControl(name) != null)) {
             return list[counter].FindControl(name);
         }
        
         else {
             Control control = getControl(list[counter].Controls, name);
             if ((control != null)) {
                 return control;
             }
         }
     }
    
     return null;
    
 }
}
